package com.springhibernate.demo.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.springhibernate.demo.dao.IOrderDao;
import com.springhibernate.demo.entity.Order;

@Service
@Transactional
public class OrderService implements IOrderService 
{
	@Autowired
	private IOrderDao orderDao;


	@Transactional(readOnly=true)
	public Order findOne(Long id) {
		return orderDao.findOne(id);
	}

	@Transactional(readOnly=true)
	public List<Order> findAll() {
		System.out.println("OrderService findAll method!");
		return (List<Order>) orderDao.findAll();
	}
	
	@Override
	public void save(Order entity) {
		orderDao.save(entity);
	}


	@Override
	public void delete(Order entity) {
		orderDao.delete(entity);

	}

	@Override
	public void delete(Long id) {
		orderDao.delete(id);
	}



}
